/*
 * Copyright (C) 2013 Daniel Treffenstädt <daniel@treffenstaedt.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#ifndef O_GUIOBJECT_H
#define O_GUIOBJECT_H

#include "../OGlobal.h"

#include "../Core/OSize.h"
#include "../Core/OPosition.h"

O_START_NAMESPACE

class O_EXPORT GUIObject
{
public:
	enum class Stretch
	{
		Minimum,
		None,
		Normal,
		Maximum
	};

private:
	Size		m_minSize;
	Size		m_size;
	Size		m_maxSize;
	Position	m_position;
	Stretch		m_stretch;
	bool		m_visible;
	bool		m_changed;

public:
	GUIObject();
	GUIObject(Size s);

	void setMinSize(Size s);
	Size minSize();

	void setMaxSize(Size s);
	Size maxSize();

	void resize(Size s);
	Size size();
	unsigned short width();
	unsigned short height();

	void move(Position p);
	Position position();
	unsigned short x();
	unsigned short y();

	void setStretch(Stretch s);
	Stretch stretch();

	void hide();
	void show();
	bool visible();

	bool changed();

protected:
	void setVisible(bool state);
	void setChange(bool state);

	virtual void changeEvent() = 0;
	virtual void resizeEvent() = 0;
	virtual void moveEvent() = 0;
};

O_END_NAMESPACE

#endif // O_GUIOBJECT_H
